package com.example.pc.greenplants;

import android.content.Intent;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private List<Personal> personalList=new ArrayList<>();
    private static final String TAG = "MainActivity";
    private ListView listView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.wdl);

        Button btn1 =(Button) findViewById(R.id.button1);
        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, Shouye.class);
                startActivity(intent);
            }
        });
        Button btn2 =(Button) findViewById(R.id.button2);
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, Shequ.class);
                startActivityForResult(intent,1);
            }
        });



        initPersonals();
        PersonalAdapter adapter = new PersonalAdapter(MainActivity.this,R.layout.activity_personal,  personalList);
        Log.e(TAG, "onCreate: "+ adapter.toString() );



    }
    private  void initPersonals(){
        Personal shoucang=new Personal(" 收藏",R.drawable.shoucang);
        personalList.add(shoucang);
        Personal xiangce=new Personal("相册",R.drawable.zhaopian);
        personalList.add(xiangce);
        Personal fenxiang=new Personal("分享",R.drawable.fenxiang);
        personalList.add(fenxiang);
        Personal qianbao=new Personal("钱包",R.drawable.qianbao);
        personalList.add(qianbao);
        Personal shezhi=new Personal("设置",R.drawable.shezhi);
        personalList.add(shezhi);
    }

}
